ftok

Section: C Library Functions (3)
Index Return to Main Contents

BSD mandoc
 

NAME

ftok - create IPC indentifier from path name  

SYNOPSIS

Fd #include <sys/types.h> Fd #include <sys/ipc.h> Ft key_t Fn ftok const char *path char id ;  

DESCRIPTION

The Fn ftok function attempts to create a unique key suitable for use with the msgget(2), semget(2) and shmget(2) functions given the Fa path of an existing file and a user-selectable Fa id .

The specified Fa path must specify an existing file that is accessible to the calling process or the call will fail. Also, note that links to files will return the same key, given the same Fa id .  

RETURN VALUES

The Fn ftok function will return -1 if Fa path does not exist or if it cannot be accessed by the calling process.  

SEE ALSO

msgget(2), semget(2), shmget(2)  

HISTORY

The Fn ftok function originate with System V and is typically used by programs that use the System V IPC routines.  

AUTHOR

Thorsten Lockert <tholo@sigmasoft.com>

 

BUGS

The returned key is computed based on the device and inode of the specified Fa path in combination with the given Fa id . Thus is is quite possible for the routine to return duplicate keys given that those fields are not 8- and 16-bit quantities like they were on System V based systems where this library routine's ancestor were originally created.


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUES
SEE ALSO
HISTORY
AUTHOR
BUGS

This document was created by man2html, using the manual pages.
Time: 16:28:58 GMT, April 18, 2022